//
//  TCP2USB.swift
//  VPai
//
//  Created by tedwen on 2017/3/10.
//  Copyright © 2017年 viatech. All rights reserved.
//

import Foundation

public class TCP2USB {
    
    public static func createHostSide(deviceListener: DeviceListener) {

        UsbHostTransfer.shareInstance.setListener(deviceListener, readListener: TCPProxy.shareInstance)
        UsbHostTransfer.shareInstance.startDiscovery()
        
        TCPProxy.shareInstance.setUSBWriter(UsbHostTransfer.shareInstance)
    }
    
    public static func deInitHostSide(){
        UsbHostTransfer.shareInstance.closeTransfer()
    }
    
    public static func getForwardAddress(host: String, port: String)->String {
        return TCPProxy.shareInstance.getForwardAddress(host, port: port)
    }

    public static func closeSocket() {
        return TCPProxy.shareInstance.closeServerSocket()
    }
}